﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using System.Web.UI.HtmlControls;
using System.Data;
using System.IO;

public partial class Admin_Page_ContactAdmin_View : BasePage
{
    TaiKhoan TK;
    protected void Page_Load(object sender, EventArgs e)
    {
        
        TK = (TaiKhoan)Session["TaiKhoan"];
        if (TK == null || (TK != null && TK.MaNhomQuyen != 1))
        {

            Response.Redirect("~/Admin/Page_Login.aspx");
        }

        if (!IsPostBack)
        {
            ((HtmlGenericControl)Master.FindControl("hPageTitle")).InnerText = "Nội dung liên hệ";

            if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                Contact myContact = ContactBLL.LayTheoMa(int.Parse(Request.QueryString["Id"]));

                lbl_TenKhachHang.Text = myContact.TenKhachHang;
                lbl_SoDienThoai.Text = myContact.SoDienThoai;
                lbl_Email.Text = myContact.Email;
                lbl_ThoiDiem.Text = myContact.ThoiDiem.ToString();
                txt_TieuDe.Text = myContact.TieuDe;
                txt_NoiDung.Text = myContact.NoiDung;
            }
        }
    }
    protected void cmd_Xoa_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
        {
            ContactBLL.Xoa(int.Parse(Request.QueryString["Id"]));
        }
        Response.Redirect("~/Admin/Page_ContactAdmin.aspx");
    }
    protected void cmd_Back_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Admin/Page_ContactAdmin.aspx");
    }
}
